//
//  Service+Storage.h
//  huimei
//
//  Created by fengyn on 16/1/20.
//  Copyright © 2016年 lexingsoft. All rights reserved.
//

#import "ServiceManager.h"

typedef NS_ENUM(NSUInteger, StorageSpaceType) {
    ///头像
    StorageSpaceTypeAvatar = 0,
    ///帖子
    StorageSpaceTypeTopic = 1,
    ///日记本
    StorageSpaceTypeDiaryBook = 2,
    ///日记
    StorageSpaceTypeDiary = 3,
    ///问答
    StorageSpaceTypeQuestion = 4,
    ///分类图标库
    StorageSpaceTypeCategoryIcon = 5,
    ///通用
    StorageSpaceTypeCommon = 6,
};

@interface ServiceManager(Storage)
+ (void)getTokenWithSpaceType:(StorageSpaceType)spaceType success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure;

+ (void)uploadImage:(UIImage *)image spaceType:(StorageSpaceType)spaceType success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure;

///根据文件名称返回本地磁盘文件路径
+ (NSString *)getLocationFilePathWithName:(NSString *)fileName;
///根据远程Url返回本地磁盘文件路径
+ (NSString *)getLocationFilePathWithUrl:(NSString *)fileUrl;
///文件是否存在
+ (BOOL)fileExistsAtPath:(NSString *)filePath;
///下载文件
+ (NSOperation *)downloadFileWithUrl:(NSString *)fileUrl
            downloadSuccess:(void (^)(NSString *localFilePath))success
            downloadFailure:(void (^)(NSError *error))failure
                   progress:(void (^)(float progress, NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))progress;
///清理Download下的所有文件
+ (void)clearDownloadDirectory;

///删除file
+ (void)removeFileWithPath:(NSString *)filePath;
@end
